import request from '@/utils/request';

export type RoleType = {
  name: string;
  _id?: string;
  registerTime?: any;
};

export async function createRole(params: RoleType): Promise<any> {
  return request('/api/createrole', {
    method: 'POST',
    data: params,
  });
}

export async function queryRole(): Promise<any> {
  return request('/api/findrole', {
    method: 'GET',
  });
}

export async function delRole(params: RoleType): Promise<any> {
  return request('/api/removerole', {
    method: 'POST',
    data: params,
  });
}

export async function updateRole(params: RoleType & { updateName: string }): Promise<any> {
  return request('/api/updaterole', {
    method: 'POST',
    data: params,
  });
}
